package redispool

import (
	"github.com/go-redis/redis"
	"github.com/sirupsen/logrus"
)

// NewRedisPool redis连接池
func NewRedisPool(redisIP, redisPort, redisPassword string, redisDB int) *redis.Client {
	client := redis.NewClient(&redis.Options{
		Addr:     redisIP + ":" + redisPort,
		Password: redisPassword, // no password set
		DB:       redisDB,       // use default DB
	})
	// defer rdb.Close()
	pong, err := client.Ping().Result()
	if err != nil {
		logrus.Errorln("Redis", pong, err)
	}
	return client
}
